package com.east.utils;

import java.util.List;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class ResultUtil {
	
	/**
     * 返回成功，传入返回体具体出參
     * @param object
     * @return
     */
    public static Result success(Object object){
        Result result = new Result();
        result.setSuccess(true);
        result.setCode(200);
        result.setMessage("success");
        result.setData(object);
       
        return result;
    }
    
    /**
     * 返回成功，传入返回体具体出參
     * @param object
     * @return
     */
    public static Result success(Integer code,Object object){
        Result result = new Result();
        result.setSuccess(true);
        result.setCode(code);
        result.setMessage("success");
        result.setData(object);
       
        return result;
    }
    /**
     * 提供给部分不需要出參的接口
     * @return
     */
    public static Result success(){
        return success(null);
    }

    /**
     * 自定义错误信息
     * @param code
     * @param msg
     * @return
     */
    public static Result error(Integer code,String msg,String data){
    	 Result result = new Result();
    	result.setCode(code);
        result.setSuccess(false);
        result.setMessage(msg);
        result.setData(data);
        return result;
    }
    /**
     * 返回成功，传入返回体具体出參
     * @param object
     * @return
     */
    public static Result error(Integer code,Object object){
        Result result = new Result();
        result.setSuccess(true);
        result.setCode(code);
        result.setMessage("error");
        result.setData(object);
        return result;
    }

}
